{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "nbsphinx": "hidden"
   },
   "source": [
    "# Random Signals and LTI-Systems\n",
    "\n",
    "*This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Measurement of Acoustic Impulse Responses\n",
    "\n",
    "The propagation of sound from one position (e.g. transmitter) to another (e.g. receiver) conforms reasonable well to the properties of a linear time-invariant (LTI) system. Consequently, the impulse response $h[k]$ characterizes the propagation of sound between theses two positions. Impulse responses have various applications in acoustics. For instance as [head-related impulse responses](https://en.wikipedia.org/wiki/Head-related_transfer_function) (HRIRs) or room impulse responses (RIRs) for the characterization of room acoustics. \n",
    "\n",
    "The following example demonstrates how an acoustic impulse response can be estimated with [correlation-based system identification techniques](correlation_functions.ipynb#System-Identification) using the soundcard of a computer. The module [`sounddevice`](http://python-sounddevice.readthedocs.org/) provides access to the soundcard via [`portaudio`](http://www.portaudio.com/)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import scipy.signal as sig\n",
    "import sounddevice as sd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Generation of the Measurement Signal\n",
    "\n",
    "We generate white noise with a uniform distribution between $\\pm 0.5$ as the excitation signal $x[k]$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "fs = 44100  # sampling rate\n",
    "T = 5  # length of the measurement signal in sec\n",
    "Tr = 2  # length of the expected system response in sec\n",
    "\n",
    "x = np.random.uniform(-0.5, 0.5, size=T * fs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Playback of Measurement Signal and Recording of Room Response\n",
    "\n",
    "The measurement signal $x[k]$ is played through the output of the soundcard and the response $y[k]$ is captured synchronously by the input of the soundcard. The length of the played/captured signal has to be of equal length when using the soundcard. The measurement signal $x[k]$ is zero-padded so that the captured signal $y[k]$ includes the complete system response.\n",
    "\n",
    "Be sure not to overdrive the speaker and the microphone by keeping the input level well below 0 dB."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Playback level:  -6.02060087394  dB\n",
      "Input level:  -2.23183822753  dB\n"
     ]
    }
   ],
   "source": [
    "x = np.concatenate((x, np.zeros(Tr * fs)))\n",
    "y = sd.playrec(x, fs, channels=1)\n",
    "sd.wait()\n",
    "y = np.squeeze(y)\n",
    "\n",
    "print(\"Playback level: \", 20 * np.log10(max(x)), \" dB\")\n",
    "print(\"Input level: \", 20 * np.log10(max(y)), \" dB\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Estimation of the Acoustic Impulse Response\n",
    "\n",
    "The acoustic impulse response is estimated by cross-correlation $\\varphi_{yx}[\\kappa]$ of the output with the input signal. Since the cross-correlation function (CCF) for finite-length signals is given as $\\varphi_{yx}[\\kappa] = \\frac{1}{K} \\cdot y[\\kappa] * x[-\\kappa]$, the computation of the CCF can be speeded up with the fast convolution method."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "h = 1 / len(y) * sig.fftconvolve(y, x[::-1], mode=\"full\")\n",
    "h = h[fs * (T + Tr) : fs * (T + 2 * Tr)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAoEAAAFECAYAAABYnuQiAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmcHFW99/Hvj0wIoJCERZYkgEi4gs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u6frkZ7AKAchEAA\n6LovSHoxv9DM1kZ/dzezWWb2BzN72cweNbMtitT/gJk9ZGYvmtkMMzupB9oOIKMIgQDQBWZ2jKQx\nkoaa2U55d6d/nH1PSde5+8clrZT01SKrGylpsbvv7+6fkDS5Em0GAIkQCABd4u6PSFri7je5+9I2\nqs5395ei6eck7V6kzkuSjjSzK83sM+6+upubCwCbEAIBoAuio39thb/Y+tT0Rkl1+RXcfa6kAyTN\nkPRTM/tRtzQSAIogBAJA1xwsaZqZHWxmW3VlRWa2s6T33f2Pkn4l6cDuaCAAFFPwnygAoEOWSDpI\n0jx3/2fefV5iuti8JH1C0tVm1ippg6Szuq2VAJDH3It9DgEAAKAv43QwAABABhECAQAAMogQCAAA\nkEGEQAAAgAwiBAIAAGQQIRAAACCDCIEAAAAZRAgEAADIoP8PyTfnwDJ5+SUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x106b89240>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(10, 5))\n",
    "t = 1 / fs * np.arange(len(h))\n",
    "plt.plot(t, h)\n",
    "plt.axis([0.0, 1.0, -1.1 * np.max(np.abs(h)), 1.1 * np.max(np.abs(h))])\n",
    "plt.xlabel(r\"$t$ in s\")\n",
    "plt.ylabel(r\"$\\hat{h}[k]$\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "nbsphinx": "hidden"
   },
   "source": [
    "**Copyright**\n",
    "\n",
    "This notebook is provided as [Open Educational Resource](https://en.wikipedia.org/wiki/Open_educational_resources). Feel free to use the notebook for your own purposes. The text is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/), the code of the IPython examples under the [MIT license](https://opensource.org/licenses/MIT). Please attribute the work as follows: *Sascha Spors, Digital Signal Processing - Lecture notes featuring computational examples*."
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  },
  "nbsphinx": {
   "execute": "never"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
